Lack of Cohesion of Methods 1 (LCOM1)

Description:

Takes each pair of methods in the class and determines the set of fields they each access. If they have disjoint sets of field accesses, increase the count P by one. If they share at least one field access, then increase Q by one. After considering each pair of methods:

RESULT = (P > Q) ? (P - Q) : 0

A low value indicates high coupling between methods, which indicates a high testing effort because many methods can affect the same attributes and potentially has low reusability. The definition of this metric was provided by Chidamber and Kemerer in 1993.